package com.caigou.controller;

import com.caigou.service.PageService;
import com.caigou.util.Result;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/page/")
public class PageController {


    @Resource
    private PageService pageService;

    @ApiOperation("更新碎片文件--处理没有主动更新逻辑的碎片文件(当前碎片需要没有具体参数)")
    @RequestMapping("buildFragment")
    public Result buildFragment(){
        return pageService.buildFragment();
    }

    @RequestMapping("buildHtml")
    public Result buildHtml(){
        return pageService.buildHtml();
    }

    @ApiOperation("根据文章类型批量更新文章静态页--同步任务需注意处理数量")
    @RequestMapping("buildHtmlByArticleType")
    public Result buildHtmlByArticleType(@RequestParam("articleType") Integer articleType){
        return pageService.buildHtmlByArticleType(articleType);
    }
}
